package com.oriole.api.module.sys.service.impl;

import com.oriole.api.module.sys.repository.SysJobLogRepository;
import com.oriole.api.module.sys.service.ISysJobLogService;
import com.oriole.common.util.ConvertUtil;
import com.oriole.entity.sys.SysJobLog;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Created by IntelliJ IDEA.
 *
 * @author doublelife
 * Date: 2020/9/20 22:46
 * description:
 */
@Service
public class SysJobLogServiceImpl implements ISysJobLogService {

    @Resource
    private SysJobLogRepository sysJobLogRepository;

    @Override
    public SysJobLog save(SysJobLog jobLog) {
        return sysJobLogRepository.save(jobLog);
    }

    @Override
    public void deleteJobLogByIds(String ids) {
        Long[] longs = ConvertUtil.toLongArray(ids);
        for (Long id : longs) {
            sysJobLogRepository.deleteById(id);
        }
    }

    @Override
    public void deleteById(Long id) {
        sysJobLogRepository.deleteById(id);
    }

    @Override
    public SysJobLog findById(Long id) {
        return sysJobLogRepository.findById(id).orElse(new SysJobLog());
    }

}
